  {layout name="common/layout" /}
<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a></div>
<div class="Hui-article-box" style="margin-top: 37px;">
	<div class="breadcrumb"><i class="Hui-iconfont"></i> <a href="index.html" >首页</a> 
		<span class="c-999 en">&gt;</span>
		<a href="javascript:void(0);" >订单详情</a> 
	</div>
	<div class="Hui-article">
			<div class="confirm">
				当前订单状态：
						{if condition="$data.order.order_is_delete eq '0'"}
							{if condition="$data.order.order_status eq '1'"}
								待支付
							{else /}
								 {if condition="$data.order.order_refund_goods_status eq '1'"}
									退款成功
								 {elseif condition="$data.order.order_refund_goods_status eq '2'"}
				                  {in name="$data.order.order_shipping_status" value="2,3,4"}
				                   退货待结算
				                  {/in}
				                 {in name="$data.order.order_shipping_status" value="5"}
				                 退货待确认
				                  {/in}
				                 {in name="$data.order.order_shipping_status" value="6"}
				                  退货成功
				                    {/in}
				                {elseif condition="$data.order.order_refund_goods_status eq '4'"}
								  {in name="$data.order.order_shipping_status" value="2,3,4,5,6"}
				                        退货成功
				                    {/in}
								{else /}
									{if condition="$data.order.order_shipping_status eq '1'"}
										待发货
									{elseif condition="$data.order.order_shipping_status eq '2'"}
										待确认收货
									{elseif condition="$data.order.order_shipping_status eq '3'"}
										待归还
									{elseif condition="$data.order.order_shipping_status eq '4'"}
										待结算
									{elseif condition="$data.order.order_shipping_status eq '5'"}
										待确认结算单
									{elseif condition="$data.order.order_shipping_status eq '6'"}
										成功订单
									{elseif condition="$data.order.order_shipping_status eq '7'"}
										成功订单
									{/if}
								{/if}
							{/if}
						{else /}
							无效订单
						{/if}
			</div>
			<div class="article-order">
				  	<div class="recond-titles" >
					   <h3 >订单信息</h3>
					</div>
				 	<div class="detail_messBody">
						  <table class="table table-border table-bg  table-bordered">
						<tr class="text-l">
							<td colspan="8"><p class="order-p"><a href="">订单号:{$data.order.order_order_sn}</a></p></td>
						</tr>
 						<tr class="text-c first-tr">
 							<td style="width: 220px;">产品</td>
 							<td>用户名</td>
 							<td>数量</td>
 							<td>总租金</td>
 							<td>押金</td>
 							<td>运费</td>
 							<td>合计</td>
 							<td>订单状态</td>
  						</tr>
  						<tr  class="text-c">
							<td style="width: 220px;">{$data.order.goods_name}</td>
							<td>{$data.order.user_phone}</td>
							<td>{$data.order.goods_amount}</td>
							<td style="font-weight: bold;">
								￥{$data.order.order_rent_price}
								{if condition="$data.order.relet_rent_price gt '0'"}
								(续租:￥{$data.order.relet_rent_price})
								{/if}
							</td>
							<td>￥{$data.order.order_deposit}</td>
							<td>￥{$data.order.order_freight}</td>
							<td>￥{$data.order.order_rent_price+$data.order.order_deposit+$data.order.order_freight}（含运费）</td>
 							<td><span>
								       {switch name="$data.order.order_shipping_status"}
											{case value="1"}{if condition="$data.order.order_status eq '1'"}待支付{else /}{if condition="$data.order.order_refund_goods_status neq '0'"}退款订单{else /}待发货</a>{/if}{/if}{/case}
											{case value="2"}{if condition="$data.order.order_refund_goods_status eq '2'"}退款退货订单，请发布结算单</a>{else /}已发货</a>{/if}{/case}
											{case value="3"}{if condition="$data.order.order_refund_goods_status eq '2'"}退款退货订单，请发布结算单</a>{else /}待归还{/if}{/case}
											{case value="4"}{if condition="$data.order.order_refund_goods_status eq '2'"}退款退货订单，请发布结算单</a>{else /}待结算</a>{/if}{/case}
											{case value="5"}待确认{/case}
											{case value="6"}{if condition="($data.order.order_refund_goods_status eq '2')  OR ($data.order.order_refund_goods_status eq '4')"}退货成功{else /}成功订单{/if}{/case}
											{case value="7"}成功订单{/case}
											{case value="8"}无效订单{/case}
										{default /}待支付
										{/switch}

							</span></td>
  						</tr>
					</table>
						 <ul class="detail_timeList">
							 <li class="detail_timeSingle">
								付款时间：
								<span>{if condition="$data.order.order_pay_time neq '0'"}{$data.order.order_pay_time|date="Y-m-d H:i:s",###}{else /}{/if}</span>
							 </li>
							 <li class="detail_timeSingle">
								 发货时间：
								<span >{if condition="$data.order.order_shipping_time neq '0'"}{$data.order.order_shipping_time|date="Y-m-d H:i:s",###}{else /}{/if}</span>
							 </li>
								 <li class="detail_timeSingle">
									用户确认收货时间：
								<span >{if condition="$data.order.order_delivery_time neq '0'"}{$data.order.order_delivery_time|date="Y-m-d H:i:s",###}{else /}{/if}</span>
							 </li>
							 <li class="detail_timeSingle">
								 归还时间：
								<span>{if condition="$data.order.order_goods_refund_time neq '0'"}{$data.order.order_goods_refund_time|date="Y-m-d H:i:s",###}{else /}{/if}</span>
							 </li>
							 <li class="detail_timeSingle">
								 结算单生成时间：
								<span >{if condition="$data.order.order_settlement_bill_generation_time neq '0'"}{$data.order.order_settlement_bill_generation_time|date="Y-m-d H:i:s",###}{else /}{/if}</span>
							 </li>
							 <li class="detail_timeSingle">
								结算单确认时间：
								<span >{if condition="$data.order.order_settlement_bill_confirm_time neq '0'"}{$data.order.order_settlement_bill_confirm_time|date="Y-m-d H:i:s",###}{else /}{/if}</span>
							 </li>
							 
							 <li class="detail_timeSingle">
								 申请退款时间：
								<span>{if condition="$data.order.order_apply_refund_time neq '0'"}{$data.order.order_apply_refund_time|date="Y-m-d H:i:s",###}{else /}{/if}</span>
							 </li>
							 <li class="detail_timeSingle">
								 申请退款退货时间：
								<span >{if condition="$data.order.order_apply_refund_goods_time neq '0'"}{$data.order.order_apply_refund_goods_time|date="Y-m-d H:i:s",###}{else /}{/if}</span>
							 </li>
						 </ul>
						<p  class="p-te">
							<span>收货地址：</span>
							{if condition="$data.order.order_express_type eq '3'"}
							<span>{$data.order.since_name}</span>
							<span>{$data.order.since_tel}</span>
							<span>{$data.order.province_name}{$data.order.city_name}{$data.order.region_name}{$data.order.since_detailed_address}</span>
							{else/}
							<span>{$data.order.order_receiver_name}</span>
							<span>{$data.order.order_mobile}</span>
							<span>{$data.order.order_province}{$data.order.order_city}{$data.order.order_district}{$data.order.order_detailed}</span>
							{/if}
						</p>
						<p class="p-te">
				 			<span>租赁时间：</span>
				 			<span >{if condition="($data.order.order_goods_rent_time neq '0')AND($data.order.order_goods_return_time neq '0')"}{$data.order.order_goods_rent_time|date="Y-m-d",###}至{$data.order.order_goods_return_time|date="Y-m-d",###}{else /}{/if}</span>
						</p>
						<p class="p-te">
				 			<span>支付方式：</span>
				 			<span>{if condition="$data.order.pay_type eq '1'"}微信{else/}支付宝{/if}</span>
						</p>
						<p class="p-te">
				 			<span>买家留言：</span>
				 			<span>{$data.order.goods_message_content}</span>
						</p>
						<i style="margin:10px 0;border-bottom:1px solid #d0d0d0; height:0;display:block"></i>
				 		<p class="p-te">
				 			<span>申请退款原因：</span>
				 			<span>{if condition="$data.order.order_refund_goods_status eq '1'"}{$data.order.order_refund_content}{else/}{/if}</span>
						</p>
				 		<p class="p-te">
							<span>申请退货原因：</span>
				 			<span>{if condition="($data.order.order_refund_goods_status eq '2') or ($data.order.order_refund_goods_status eq '4')"}{$data.order.order_refund_content}{else/}{/if}</span>
						</p>
					</div>
					{if condition="($data.order.order_shipping_status egt '5')AND($data.order.order_shipping_status neq '8')AND($data.order.order_shipping_status neq '9')"}
					<div class="recond-titles" >
					   <h3 >结算信息</h3>
				 	</div>
				 	<div class="detail_messBody">
						<p class="p-te"><span>&nbsp;&nbsp;实际租金：</span><span>￥{if condition="$data.order.order_refund_goods_status > 0"}0{else/}
								{$data.order.order_rent_price-$data.order.relet_rent_price|sprintf ="%.2f",###}
								{if condition="$data.order.order_activity_id gt '0'"}
								&nbsp;&nbsp;(活动价:折扣{$data.order.market_rate}%)
								{/if}
							{/if}</span></p>
						<p class="p-te"><span>&nbsp;&nbsp;续租租金：</span><span>
							￥{$data.order.relet_rent_price|sprintf ="%.2f",###}
						</span></p>
						<p class="p-te" style="font-weight: bold;"><span>&nbsp;&nbsp;合计租金：</span><span>
							￥{$data.order.order_rent_price|sprintf ="%.2f",###}
						</span></p>
						<p class="p-te"><span>&nbsp;&nbsp;平台优惠券：</span><span>
							￥{$data.order.coupon_amount|sprintf ="%.2f",###}
						</span></p>
						<p class="p-te"><span>&nbsp;&nbsp;店铺优惠券：</span><span>
							￥{$data.order.store_coupon_amount|sprintf ="%.2f",###}
						</span></p>
						<p class="p-te"><span>&nbsp;&nbsp;违约金：</span><span>{$data.settlement_bill_liquidated}</span></p>
						<p class="p-te"><span>&nbsp;&nbsp;损失赔偿金：</span><span>{$data.settlement_bill_damages}</span></p>
						<p class="p-te"><span>&nbsp;&nbsp;运费：</span><span>{$data.order.order_freight}</span></p>
						<p class="p-te"><span>&nbsp;&nbsp;小计：</span>
							<span>
								{$data.settlement_bill_total}</span>
						</p>
						<p class="p-te"><span>&nbsp;&nbsp;实际退款金额：</span><span>{$data.order.actual_rent_total-$data.settlement_bill_total}</span></p>
						<p class="p-te"><span>&nbsp;&nbsp;备注：</span><span>{$data.settlement_bill_remarks}</span></p>
					</div>
					{else /}{/if}

				{if condition="($data.order.order_shipping_status neq '9')"}
				  	<div class="recond-titles" >
					   <h3 >收货物流信息</h3>
					 </div>
					<div class="detail_messBody">
						<p  class="p-te">
							<span>收货地址：</span>
							{if condition="$data.order.order_express_type eq '3'"}
							<span>{$data.order.since_name}</span>
			                <span>{$data.order.since_tel}</span>
			                <span>{$data.order.province_name}{$data.order.city_name}{$data.order.region_name}{$data.order.since_detailed_address}</span>
						    {elseif condition="$data.order.order_express_type eq '2'" /}
			                <span>{$data.order.order_receiver_name}</span>
			                <span>{$data.order.order_mobile}</span>
                            <span>{$data.order.order_province}{$data.order.order_city}{$data.order.order_district}{$data.order.order_detailed}</span>
							{elseif condition="$data.order.order_express_type eq '1'" /}
			                <span>{$data.order.order_receiver_name}</span>
			                <span>{$data.order.order_mobile}</span>
                            <span>{$data.order.order_province}{$data.order.order_city}{$data.order.order_district}{$data.order.order_detailed}</span>
                            {else /}
							<span></span>
			                <span></span>
                            <span></span>
							{/if}
						</p>
					<p class="p-te"><span>物流方式:</span><span>{if condition="$data.order.order_express_type eq '3'"}自提点 {elseif condition="$data.order.order_express_type eq '2'" /}上门{else /}快递{/if}</span></p>
					<p class="p-te"><span>物流公司:</span><span class="ship_company">{if condition="$data.order.order_express_type eq '1'"}
						{if condition="($data.order.ship_count_down) gt '0'"}
						<select class="ship_type" style="width: 200px;height: 25px;font-size:14px;background-color:#e9e9e9;" disabled>
							<option value="shunfeng">顺丰快递</option>
							<option value="shentong">申通快递</option>
							<option value="zhongtong">中通快递</option>
							<option value="yuantong">圆通快递</option>
							<option value="yunda">韵达快递</option>
							<option value="gdems">EMS快递</option>
							<option value="quanfeng">全峰快递</option>
							<option value="tiantian">天天快递</option>
							<option value="debang">德邦快递</option>
							<option value="huitong">百世快递</option>
							<option value="zhaijisong ">宅急送</option>
							<option value="auto">其他</option>
						</select>
						<a class="edit_ship_company"><span class="index_orderType">
							修改
						</span></a>
						<a class="save_ship_company" style="display: none;"><span class="index_orderType">
							保存
						</span></a>
						<label style="margin-left: 20px;" class="time_down">
							倒计时:<span class="time_num"></span>&nbsp;(发货之后24小时内,可对错误快递信息纠正)
						</label>
						{else /}
						{$data.order.order_deliver_company}
						{/if}
						{else /}{/if}</span></p>
					<p class="p-te"><span>运单号:</span><span  class="ship_number">{if condition="$data.order.order_express_type eq '1'"}
						{if condition="($data.order.ship_count_down) gt '0'"}
						<input type="text" class="ship_expressid" disabled style="width: 200px;height: 25px;position: relative;right: 30px;border: 0.5px rgb(169, 169, 169) solid" value="{$data.order.order_deliver_expressid}"/>
						<a class="edit_ship_number"><span class="index_orderType" style="margin-left: -30px;">
							修改
						</span></a>
						<a class="save_ship_number" style="display: none;"><span class="index_orderType" style="margin-left: -30px;">
							保存
						</span></a>
						<label style="margin-left: 18px;" class="time_down">
							倒计时:<span class="time_num"></span>&nbsp;(发货后24小时内,可对错误快递信息纠正)
						</label>
						{else /}
						{$data.order.order_deliver_expressid}
						{/if}
						{else /}{/if}</span></p>
					 </div>
					<div class="recond-titles" >
					   <h3 >归还物流信息</h3>
					</div>
					<div class="detail_messBody">
						<p  class="p-te">
							<span>归还地址:</span>
						{if condition="($data.order.order_shipping_status >='3') and ($data.order.order_shipping_status <'8')"}
							
							{if condition="$data.order.order_express_type eq '3'" }
							<span>{$data.since_name}</span>
			                <span>{$data.since_tel}</span>
			                <span>{$data.since_province}{$data.since_city_name}{$data.since_region_name}{$data.since_detailed_address}</span>
						    
							{elseif condition="$data.order.order_express_type eq '2'" /}
			                <span>{$data.order.order_receiver_name}</span>
			                <span>{$data.order.order_mobile}</span>
                            <span>{$data.order.order_province}{$data.order.order_city}{$data.order.order_district}{$data.order.order_detailed}</span>
							
							{elseif condition="$data.order.order_express_type eq '1'" /}
							<span>{$data.revent_name}</span>
							<span>{$data.revent_tel}</span>
							<span>{$data.revent_province}{$data.revent_city_name}{$data.revent_region_name}{$data.revent_detailed_address}</span>

							{/if}
						{else /}
							<span></span>
			                <span></span>
                            <span></span>
						{/if}
                        
						
						</p>
						{if condition="$data.order.order_shipping_status >='3' "}
					    
						           {if condition="$data.order.order_express_type eq '3'"}
						<p class="p-te"><span>物流方式:</span><span>自提点</span></p></p>
						<p class="p-te"><span>物流公司:</span><span></span></p></p>
						<p class="p-te"><span>运单号:</span><span></span></p></p>
						           {elseif condition="$data.order.order_express_type eq '2'" /}
						<p class="p-te"><span>物流方式:</span><span>上门</span></p></p>
						<p class="p-te"><span>物流公司:</span><span></span></p></p>
						<p class="p-te"><span>运单号:</span><span></span></p></p>
						           {elseif condition="$data.order.order_express_type eq '1'" /}
			            <p class="p-te"><span>物流方式:</span><span>快递</span></p>
						<p class="p-te"><span>物流公司:</span><span>{$data.return_deliver_company}</span></p>
						<p class="p-te"><span>运单号:</span><span>{$data.return_expressid}</span></p>
                                   {/if}

						{else /}
						<p class="p-te"><span>物流方式:</span></p>
						<p class="p-te"><span>物流公司:</span></p>
						<p class="p-te"><span>运单号:</span></p>
						 {/if}
					</div>
				{/if}
				  
				</div>
			</div>
	</div>
</div>
	
<script>
	var count_down = "{$data.order.ship_count_down}";
	var ship_company = "{$data.order.order_logistics_name}";
    var deliver_company = "{$data.order.order_deliver_company}";
    var deliver_expressid = "{$data.order.order_deliver_expressid}";
    //console.log("{$data.order.order_shipping_time}");
	//console.log(count_down);
    if(count_down > 0) {
        $(".ship_type").val(ship_company);
    }
	function time_down(){
        count_down = count_down -1;
        if(count_down <= 0){
            $(".ship_company").html(deliver_company);
            $(".ship_number").html(deliver_expressid);
            clearInterval(time_down)
		}
        var hour = Math.floor(count_down/3600)+"";
        var minute = Math.floor((count_down-3600*hour)/60)+"";
        var second = (count_down-3600*hour-minute*60)+"";
        if(hour.length == 1){
            hour = "0"+hour;
        }
        if(minute.length == 1){
            minute = "0"+minute;
        }
        if(second.length == 1){
            second = "0"+second;
		}
		$(".time_num").html(hour+":"+minute+":"+second);
	}
	$(function(){
		$.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0");
		if(parseInt(count_down) > 0){
		    setInterval(time_down,1000);
		}
		//编辑快递公司
		$(".edit_ship_company").click(function () {
		    $(this).hide();
            $(".save_ship_company").show();
            $(".ship_type").removeAttr("disabled");
            $(".ship_type").css("background-color","#fff");
        });
        //编辑快递单号
        $(".edit_ship_number").click(function () {
            $(this).hide();
            $(".save_ship_number").show();
            $(".ship_expressid").removeAttr("disabled");
        });
        //保存编辑快递公司
        $(".save_ship_company").click(function () {
            var ship_type_text = $(".ship_type").find("option:selected").text();
            var ship_type_val = $(".ship_type").val();
            var order_id = "{$data.order.order_id}";
            $.post("{:url('api/Order/editShipCompany')}",{name:ship_type_text,code:ship_type_val,order_id:order_id},function (data) {
                if(data.status == 1){
                    $(".ship_type").attr("disabled","disabled");
                    $(".ship_type").css("background-color","#e9e9e9");
                    $(".ship_type").val(data.data.code);
                    deliver_company = data.data.name;
                    $(".save_ship_company").hide();
                    $(".edit_ship_company").show();
                }else{
                    layer.msg(data.msg);
                }
            },'json');
        });
        //保存编辑快递单号
        $(".save_ship_number").click(function () {
            var ship_expressid = $(".ship_expressid").val();
            var order_id = "{$data.order.order_id}";
            $.post("{:url('api/Order/editShipExpressid')}",{eid:ship_expressid,order_id:order_id},function (data) {
                if(data.status == 1){
                    $(".save_ship_number").hide();
                    $(".edit_ship_number").show();
                    $(".ship_expressid").val(data.data.eid);
                    deliver_expressid = data.data.eid;
                    $(".ship_expressid").attr("disabled","disabled");
                }else{
                    layer.msg(data.msg);
				}
            },'json');
        });
	});
		var GG = {
        "kk":function(mm){
           var ym=mm;
        }
    }
	$("#page").initPage(71,1,GG.kk);
	$("#page1").initPage(71,1,GG.kk);
	$("#page2").initPage(71,1,GG.kk);
	$("#page3").initPage(71,1,GG.kk);
	$("#page4").initPage(71,1,GG.kk);
</script>
 